import { createStore } from "vuex";

const store = createStore({
  state() {
    return {
      manual: "", //选中的手册
      chapter: "", //选中的手册的某个章节
    };
  },
  mutations: {
    setManual(state, params) {
      state.manual = params;
    },
    setChapter(state, params) {
      state.chapter = params;
    },
    clearChapter(state) {
      state.chapter = "";
    },
  },
  getters: {
    getManual(state) {
      return state.manual;
    },
    getChapter(state) {
      return state.chapter;
    },
  },
});

export default store;
